cmake_minimum_required(VERSION 3.2)
project(ziptest LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 指定输出文件名
set(TARGET ziptest)
# 指定参与编译的 CPP 文件
add_executable(${TARGET} src/main.cpp)
# 指定包含路径
target_include_directories(${TARGET} PRIVATE src/ third_party/)

# 同样的逻辑处理下示例代码
set(EXAMPLE_SOURCES
    examples/examine.cpp
    examples/unzip.cpp
    examples/zip.cpp)

foreach(EXAMPLE_SOURCE IN ITEMS ${EXAMPLE_SOURCES})
    get_filename_component(EXAMPLE_NAME ${EXAMPLE_SOURCE} NAME_WE)
    set(EXAMPLE_EXECUTABLE example-${EXAMPLE_NAME})

    add_executable(${EXAMPLE_EXECUTABLE} ${EXAMPLE_SOURCE})

    target_include_directories(${EXAMPLE_EXECUTABLE}
        PRIVATE third_party/)
endforeach()